﻿#include "AlarmHistoryView.h"
#include "AlarmHistoryScene.h"

#include <QResizeEvent>
#include <QDebug>

AlarmHistoryView::AlarmHistoryView(QWidget *parent) : QGraphicsView(parent)
{
    m_pScene = new AlarmHistoryScene(this);
    setScene(m_pScene);

    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}

void AlarmHistoryView::addAlarmText(WarningLevel level, const QString &alarm)
{
    m_pScene->addAlarmText(level, alarm);
}

void AlarmHistoryView::resizeEvent(QResizeEvent *event)
{
    QGraphicsView::resizeEvent(event);
    m_pScene->setSceneRect(0, 0, this->size().width(), this->size().height());
}

